solve :: String -> String
solve [] = []
solve [x] = [x]
solve (x1:x2:xs) = x2 : x1 : solve xs

main = do
    c <- getContents
    putStr $ unlines $ map solve $ tail $ lines c 
     
    